package org.bite.lesson07;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;

public class Demo701 {
    public static void main(String[] args) throws InterruptedException {
        //创建一个阻塞队列
        BlockingQueue<Integer> queue = new LinkedBlockingQueue<>(3);
        queue.put(1);
        queue.put(2);
        queue.put(3);
        System.out.println("元素个数：" + queue.size());

        //queue.put(4);
//        System.out.println("元素个数：" + queue.size());
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println(queue.take());
        System.out.println("元素个数：" + queue.size());
        System.out.println(queue.take());
        System.out.println("元素个数：" + queue.size());
    }
}
